Skip to main content

Elliptic Curves

Elliptic curves are a core foundation of modern cryptography techniques and is used extensively in web browsers, digital security products and blockchain protocols. Here we summarise the elliptic curve knowledge required for implementing verkle tries. If elliptic curves are an unfamiliar topic to you, we would suggest diving into More Reading

Elliptic curve points as a group

Using a carefully designed addition (+) operation, we can form an abelian group out of the points of an elliptic curve.

Scalar multiplication

We can extend the addition operation for elliptic curve points to define scalar multiplication:

mP=P+P++Pm timesm*P = \underbrace{P + P + \cdots + P}_{m\ \text{times}}, where mm is an integer > 0 and PP is an elliptic curve point.

The above expression suggests that scalar multiplication is a linear time operation. However we can use the double-and-add algorithm to execute scalar multiplication in O(logN)O(\log{N}) time.

Multiscalar multiplication

Multiscalar multiplication is when we 'add together' several scalar multiplication results, e.g.

mP+nQ=P+P++Pm times+Q+Q++Qn timesm*P + n*Q = \underbrace{P + P + \cdots + P}_{m\ \text{times}} + \underbrace{Q + Q + \cdots + Q}_{n\ \text{times}}

Elliptic curves over a finite field

We can restrict an elliptic curve such that the x and y coordinates of each point is an element of Fp\mathbb{F}_p, rather than a real number R\mathbb{R}. More formally, the continuous elliptic curve defined by

y2=x3+ax+by^2 = x^3 + ax + b, where x,y,a,bRx, y, a, b \in \mathbb{R}

is restricted to

y2=x3+ax+b(modp)y^2 = x^3 + ax + b\>(mod\>p), where x,y,a,bFpx, y, a, b \in \mathbb{F}_p and pp is a prime number

This transforms the graph from a continuous curve to a discrete set of points.

merkle_00 Figure 1. Elliptic curve defined by y2=x3+2x+3y^2 = x^3 + 2x + 3 transformed from being defined over R\mathbb{R} to F29\mathbb{F}_{29}

The important mathematical result here is that elliptic curve points over a finite field still form an abelian group.

Elliptic curve discrete logarithm problem (ECDLP)

For the scalar multiplication Q=nPQ = n*P

Where PP is an elliptic curve point over Fp\mathbb{F}_p, nn is a scalar Fp\in \mathbb{F}_p and QQ is the scalar multiplication result (also an elliptic curve point over Fp\mathbb{F}_p by the group property of closure).

  • Given nn and PP, it is 'easy' to find QQ => Scalar multiplication, known O(logN)O(\log{N}) algorithm
  • Given QQ and PP, it is 'hard' to find nn => Discrete logarithm problem, exponential time algorithms for the general case

This mathematical result forms a trapdoor function, and is a core security assumption of applications using elliptic curve cryptography.

The ECDLP is a 'harder' problem than the general discrete logarithm problem (DLP) in the sense that the fastest known general-purpose algorithm for the ECDLP has an exponential time complexity, whereas the fastest known general-purpose algorithm for the DLP has a subexponential time complexity. Hence cryptographic keys based on ECDLP can be significantly smaller than keys based on DLP, and still be more secure.

Elliptic curve forms

Elliptic curves can be mathematically expressed in multiple forms - Weierstrass, Montgomery and twisted Edwards forms are commonly used in cryptographic applications. The y2=x3+ax+by^2 = x^3 + ax + b where a,bFpa, b \in \mathbb{F}_p expression we have previously referred to represents the Weierstrass form.

Montgomery form (by2=x3+ax2+xby^2 = x^3 + ax^2 + x, where a,bFpa, b \in \mathbb{F}_p) and twisted Edwards form (ax2+y2=1+dx2y2ax^2 + y^2 = 1 + dx^2y^2, where a,dFp{0}a, d \in \mathbb{F}_p \setminus \{0\}) are frequently preferred in practical software implementations because addition and scalar multiplication operations are more efficient, and Weierstrass form implementations suffer from vulnerability to side-channel attacks.

Every Montgomery form curve can be transformed into a mathematically equivalent twisted Edwards form curve, this relationship is known as birational equivalence. However over the finite field Fp\mathbb{F}_p, not every Weierstrass form curve can be transformed into a twisted Edwards curve - only a small subset of Weierstrass curves can be transformed into a twisted Edwards curve in Fp\mathbb{F}_p.

More Reading